package com.zmn.oms.business.interfaces.work;

import com.zmn.oms.common.annotation.ZsNormalOrderWorkLog;
import com.zmn.oms.common.constant.OrderLogConsts;
import com.zmn.oms.common.dro.orderpay.OrderPayResultDRO;
import com.zmn.oms.common.exception.OmsBaseException;
import com.zmn.oms.model.bo.orderamount.OrderAmountCalcBO;
import com.zmn.oms.model.bo.work.ChangeOriginalAmountDiscountBO;
import com.zmn.oms.model.dto.work.refund.WorkRefundResultDTO;
import com.zmn.oms.model.dto.work.workamount.*;
import com.zmn.oms.model.entity.work.OrderWork;

/**
 * 类描述：工单金额
 *
 * @author heciqi
 * @date 2018/11/7 15:06
 */
public interface OrderWorkAmountBService {

    /**
     * 修改原价
     *
     * @param updateAmountDTO
     * @return 影响行数
     */
    void updateOriginalAmount(WorkUpdateAmountDTO updateAmountDTO) throws OmsBaseException;

    /**
     * 删除原价
     *
     * @param updateAmountDTO
     * @throws OmsBaseException
     */
    void deleteOriginalAmount(WorkUpdateAmountDTO updateAmountDTO) throws OmsBaseException;

    /**
     * 修改预付款
     *
     * @param orderWorkAmountDTO
     * @return 影响行数
     */
    void updatePrepayAmount(WorkAmountDTO orderWorkAmountDTO) throws OmsBaseException;

    /**
     * 预付款支付
     *
     * @param orderWorkPayDTO
     * @return 影响行数
     */
    void updatePrepayAmountPay(WorkPayDTO orderWorkPayDTO);

    /**
     * 修改定金
     *
     * @param updateAmountDTO
     * @return 影响行数
     */
    void updateDepositAmount(WorkUpdateAmountDTO updateAmountDTO) throws OmsBaseException;

    /**
     * 定金支付
     *
     * @param orderWorkPayDTO
     * @return 影响行数
     */
    void updateDepositAmountPay(WorkPayDTO orderWorkPayDTO);

    /**
     * 修改优惠金额
     *
     * @param orderWorkAmountDTO
     * @return 影响行数
     */
    void updateDiscountAmount(WorkAmountDTO orderWorkAmountDTO) throws OmsBaseException;

    /**
     * 优惠金额支付
     *
     * @param orderWorkPayDTO
     * @return 影响行数
     */
    void updateDiscountAmountPay(WorkPayDTO orderWorkPayDTO);

    /**
     * 修改退款金额
     *
     * @param orderWorkAmountDTO
     * @return 影响行数
     */
    void updateRefundAmount(WorkAmountDTO orderWorkAmountDTO);

    /**
     * 退款金额支付
     *
     * @param orderWorkPayDTO
     * @return 影响行数
     */
    void updateRefundAmountPay(WorkPayDTO orderWorkPayDTO);

    /**
     * 更新配件金额
     *
     * @param orderWork
     * @return 影响行数
     */
    void updatePartAmount(OrderWork orderWork);

    /**
     * 更新原价和定金
     *
     * @param updateAmountDTO
     */
    void updateOriginalAndDepositAmount(WorkUpdateAmountDTO updateAmountDTO) throws OmsBaseException;

    /**
     * 更新渠道预收
     *
     * @param updateAmountDTO
     * @throws OmsBaseException
     */
    void updateChannelPrepayAmount(WorkUpdateAmountDTO updateAmountDTO) throws OmsBaseException;

    /**
     * 原价变动实时计算优惠金额
     *
     * @param updateAmountDTO
     * @param dbOrderWork
     * @return
     */
    ChangeOriginalAmountDiscountBO getDiscountAmountByOriginalAmountChange(WorkUpdateAmountDTO updateAmountDTO, OrderWork dbOrderWork) throws OmsBaseException;

    /**
     * 校验工单边界值
     *
     * @param validateWorkAmountDTO
     * @return
     * @throws OmsBaseException
     */
    boolean validateWorkAmount(ValidateWorkAmountDTO validateWorkAmountDTO) throws OmsBaseException;

    /**
     * 更新工程师收款支付
     *
     * @param orderPayResultDRO
     */
    void updateMasterAmountPayResult(OrderPayResultDRO orderPayResultDRO);

    /**
     * 更新定金支付
     * @param orderPayResultDRO
     */
    void updateDepositAmountPayResult(OrderPayResultDRO orderPayResultDRO);

    /**
     * 更新啄木鸟预付款
     *
     * @param orderPayResultDRO
     */
	void updatePrepayAmountPayResult(OrderPayResultDRO orderPayResultDRO);

    /**
     * 在支付完成之后更改预付款
     * @param updateAmountDTO
     * @param dbOrderWork
     */
    void updateOriginalAmountAfterPayment(WorkUpdateAmountDTO updateAmountDTO, OrderWork dbOrderWork) throws OmsBaseException;

    /**
     * 更新退款结果
     *
     * @param refundResultDTO
     */
	void updateRefundResult(WorkRefundResultDTO refundResultDTO);

    void fixedAmount(Long orderId, Long workId);

    /**
     * 更新工单金额和优惠列表
     *
     * @param orderAmountCalcBO
     * @param orderWork
     */
    void updateAmountAndDiscount(OrderAmountCalcBO orderAmountCalcBO, final OrderWork orderWork) throws OmsBaseException;

    /**
     * 异常支付
     * @param orderPayResultDRO
     */
	void addExceptionOrderPay(OrderPayResultDRO orderPayResultDRO);
}
